package com.ruix.app.model;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by hadexs on 2017/5/9.
 */

public class Lesson implements Serializable{

    private String id;
    private String name;
    private int studentNum; //参与人数
    private int sort;//排序ID
    private long discussTime; //共修时间
    private boolean learnt;
    private String chatid;

    public Lesson parse(JSONObject object) {
        if (object != null) {
            setId(object.optString("id", ""));
            setName(object.optString("name", ""));
            setStudentNum(object.optInt("num", 0));
            setSort(object.optInt("sort", 0));
            setDiscussTime(object.optLong("discuss_at", 0)*1000);
            setLearnt(object.optInt("learnt", 0) == 1);
            setChatid(object.optString("chatid",""));
        }
        return this;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getStudentNum() {
        return studentNum;
    }

    public void setStudentNum(int studentNum) {
        this.studentNum = studentNum;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public long getDiscussTime() {
        return discussTime;
    }

    public void setDiscussTime(long discussTime) {
        this.discussTime = discussTime;
    }

    public boolean isLearnt() {
        return learnt;
    }

    public void setLearnt(boolean learnt) {
        this.learnt = learnt;
    }

    public String getChatid() {
        return chatid;
    }

    public void setChatid(String chatid) {
        this.chatid = chatid;
    }

    @Override
    public String toString() {
        return "Lesson{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", studentNum=" + studentNum +
                ", sort=" + sort +
                ", discussTime=" + discussTime +
                ", learnt=" + learnt +
                ", chatid='" + chatid + '\'' +
                '}';
    }
}
